home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
273_01
/
sreadc.ca
< prev
next >
Wrap
Text File
|
1988-02-09
|
911b
|
40 lines
#include <dos.h>
sread_c(int row, int col, char *area)
/* This will do a read a character at row,col and
place it into the area pointer to by area.
*/
{
extern int color, mono, cga, ega, scrseg, bios;
union REGS inregs;
int scrofs, orow, ocol;
char pchar;
char far *base;
char far *work;
if(mono) base=(char far *)0xb0000000;
else base=(char far *)0xb8000000;
if(bios) {
locate(row,col) ;
inregs.h.ah=0x08;
inregs.h.bh=0x00;
int86(0x10,&inregs,&inregs);
*area=inregs.h.al;
return(0);
}
scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
work = base + scrofs;
asm les bx,work
if(cga) {
asm mov dx,03dah
asm in al,dx
asm test al,1
asm jnz $-3
asm in al,dx
asm test al,1
asm jz $-3
}
asm mov cl,byte ptr es:[bx]
asm mov pchar,cl
*area = pchar;
return(0);
}